package com.example.zhanghao.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.zhanghao.DTO.OrderDto;
import com.example.zhanghao.DTO.PayDto;
import com.example.zhanghao.Entity.Account;
import com.example.zhanghao.Entity.Orders;
import com.example.zhanghao.Entity.User;
import com.example.zhanghao.VO.CommonVo;
import com.example.zhanghao.VO.OrderVo;
import com.example.zhanghao.VO.PageVo;
import com.example.zhanghao.services.impl.AccountServiceImpl;
import com.example.zhanghao.services.impl.OrdersServiceImpl;
import com.example.zhanghao.services.impl.UserServiceImpl;
import com.example.zhanghao.utils.CopyUtil;
import com.example.zhanghao.utils.HupijiaoHandler;
import com.example.zhanghao.utils.LanTuHandler;
import com.example.zhanghao.utils.SnowFlake;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

@RestController //这是返回接口
@RequestMapping("/pay")
public class PayController {

    private static final Logger LOG = LoggerFactory.getLogger(PayController.class);

    @Resource
    private SnowFlake snowFlake;

    @PostMapping("/hupijiao")
    public CommonVo<String> hupijiao(@Valid @RequestBody PayDto req) {
        String result = HupijiaoHandler.getHashAndTime(req);
        CommonVo<String> commonVo = new CommonVo();
        commonVo.setData(result);
        return commonVo;
    }

    @PostMapping("/lanTu")
    public CommonVo<String> lanTu(@Valid @RequestBody PayDto req) {
        String result = LanTuHandler.getHashAndTime(req);
        CommonVo<String> commonVo = new CommonVo();
        commonVo.setData(result);
        return commonVo;
    }

}

